import App from './App'

// #ifndef VUE3
import Vue from 'vue'
import uView from '@/uni_modules/uview-ui'
import i18n from './i18n';
import store from './store';
import './uni.promisify.adaptor'
import Loading from '@/components/Loading.vue';
import TopBar from "@/components/TopBar.vue"
import {ImageBase} from '@/api/base.js'; //导入接口的前缀地址
Vue.component('TopBar', TopBar);
Vue.component('Loading', Loading);
Vue.config.productionTip = false;

//图片函数
Vue.prototype.getImgSrc = function(img) {
	if (img.match(/^http(s)?\:\/\/.*/)) {
	    return img;
	} else {
	    return ImageBase + img;
	}
}
//颜色
Vue.prototype.colortopic = function() {
	return '#2aad67';
}
//时间转换
Vue.prototype.timestampToDate = function(value) {
	var date = new Date();
	date.setTime(value);
	var month = date.getMonth() + 1;
	var hours = date.getHours();
	if (hours < 10)
		hours = "0" + hours;
	var minutes = date.getMinutes();
	if (minutes < 10)
		minutes = "0" + minutes;
	var time = date.getFullYear() + "-" + month + "-" + date.getDate();
	return time;
}

App.mpType = 'app'
const app = new Vue({
	...App,
	i18n,
	store
})

Vue.use(uView)
app.$mount()
// #endif

// #ifdef VUE3
import {
	createSSRApp
} from 'vue'
export function createApp() {
	const app = createSSRApp(App)
	return {
		app
	}
}
// #endif